home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / cprog / c_tutor.lha / C_Tutor / UNION1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-05-28  |  389 b   |  19 lines

  1. main()
  2. {
  3. union {
  4.    int value;     /* This is the first part of the union */
  5.    struct {
  6.       char first;   /* These two values are the second     */
  7.       char second;
  8.    } half;
  9. } number;
  10.  
  11. long index;
  12.  
  13.    for (index = 12;index < 300000;index += 35231) {
  14.       number.value = index;
  15.       printf("%8x %6x %6x\n",number.value, number.half.first,
  16.               number.half.second);
  17.    }
  18. }
  19.